<?php require_once('./core/import.php'); ?>
<?php
#获取数据
$OldPassword=Functions::FormArgs('OldPassword');
$NewPassword=Functions::FormArgs('NewPassword');
$ConfirmPassword=Functions::FormArgs('ConfirmPassword');

#更新数据
$User=new User(User::Session('Username'),User::Session('Password'),TRUE);
{
    if($User->IsLogin())
    {
        if($User->Data['Password']!=User::EncryptPassword($OldPassword,$User->Username))
        {
            echo 'PasswordWrong';
        }
        else
        {
            $User->Update(array
            (
                'Password'=>$User->EncryptPassword($NewPassword,$User->Username)
            ));
            $User->Login();
            echo 'Success';
        }
    }
    else
    {
        echo 'NotLogined';
    }
}
$User=NULL;
?>